package cn.com.cifi.mars.service.impl;
import cn.com.cifi.mars.bean.dto.VsMarsFeeDto;
import cn.com.cifi.mars.constant.MyConstants;
import cn.com.cifi.mars.entity.VsMarsFee;
import cn.com.cifi.mars.mapper.mars.VsMarsFeeMapper;
import cn.com.cifi.mars.service.VsMarsFeeService;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.Arrays;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author JingYuanXiang
 * @since 2020-11-12
 */
@Service
public class VsMarsFeeServiceImpl extends ServiceImpl<VsMarsFeeMapper, VsMarsFee> implements VsMarsFeeService {

    @Autowired
    private VsMarsFeeMapper vsMarsFeeMapper;

    private static final List<String> payTypeList = Arrays.asList(MyConstants.LOANS,MyConstants.NOT_LOANS);

    @DS("mym")
    @Transactional(propagation = Propagation.REQUIRES_NEW)
    @Override
    public List<VsMarsFeeDto> selectByStageId(String stageId) {
        return vsMarsFeeMapper.selectByStageId(stageId,payTypeList);
    }
    @DS("mym")
    @Transactional(propagation = Propagation.REQUIRES_NEW)
    @Override
    public List<VsMarsFeeDto> selectByProjectId(String projectId) {
        return vsMarsFeeMapper.selectByProjectId(projectId,payTypeList);
    }

    @DS("mym")
    @Transactional(propagation = Propagation.REQUIRES_NEW)
    @Override
    public List<VsMarsFee> selectAllByProjectId(String projectId) {
        return vsMarsFeeMapper.selectAllByProjectId(projectId,payTypeList);
    }
}
